<@_sysDept id=admin.deptId>
    <#assign
        dept=object
        containChild=object.ownsAllCategory
    />
</@_sysDept>
<@_sysDeptCategory deptId=admin.deptId!'' categoryId=categoryId!''><#assign deptCategory=object!/></@_sysDeptCategory>
<#if deptCategory?has_content&&deptCategory || dept?has_content && dept.ownsAllCategory>
    <#if parentId?has_content>
        <@_content id=parentId><#assign parent=object/></@_content>
    </#if>
    <#if 0=admin.contentPermissions><#assign userId=admin.id/></#if>
    <#if 2=admin.contentPermissions><#assign deptId=admin.deptId/></#if>
<@_contentList advanced=true status=status categoryId=categoryId containChild=containChild
            modelId=modelIds parentId=parentId emptyParent=true title=title userId=userId deptId=deptId
            startPublishDate=startPublishDate endPublishDate=endPublishDate absoluteId=false
            orderField=orderField orderType=orderType pageIndex=pageNum pageSize=numPerPage>
<@_sysAuthorized roleIds=admin.roles urls='cmsContent/add,cmsContent/delete,cmsContent/check,cmsContent/reject,cmsContent/uncheck,cmsContent/push,cmsCategory/lookupBySiteId,cmsContent/refresh,cmsContent/publish,cmsContent/moveParameters,cmsContent/changeModelParameters,cmsContent/export,cmsComment/list,cmsContent/sortParameters,cmsCategory/add'><#assign authorizedMap=map/></@_sysAuthorized>
<div class="pageHeader">
    <form class="pagerForm" action="common/content_list.html" autocomplete="off" onsubmit="return divSearch(this,'contentBox');" method="post">
        <#include "../include_page/parameters.html"/>
        <input name="categoryId" type="hidden" value="${categoryId!}"/>
        <input name="parentId" type="hidden" value="${(parent.id)!}"/>
        <div class="searchBar">
            <ul class="searchContent">
                <li>
                    <label><@t.page 'title'/>:</label><input type="text" size="20" name="title" value="${title!}" />
                </li>
                <li class="width:auto">
                    <#include "../include_page/status.html"/>
                </li>
                <li>
                    <label><@t.page 'publish_date'/>:</label>
                    <input type="text" name="startPublishDate" class="date" size="10" autocomplete="off" dateFmt="yyyy-MM-dd" value="${startPublishDate!}" />
                    <span>-</span>
                    <input type="text" name="endPublishDate" class="date" size="10" autocomplete="off" dateFmt="yyyy-MM-dd" value="${endPublishDate!}" />
                </li>
            <#if 1=admin.contentPermissions>
                <li>
                    <label><@t.page 'dept'/>:</label>
                    <#include "../include_page/deptId.html"/>
                </li>
            </#if>
            <#if 1=admin.contentPermissions||2=admin.contentPermissions>
                <li>
                    <label><@t.page 'content.promulgator'/>:</label>
                    <#include "../include_page/userId.html"/>
                </li>
            </#if>
                <li>
                    <label><@t.page 'model'/>:</label>
                    <#include "../include_page/modelId.html"/>
                </li>
            </ul>
            <div class="subBar">
                <ul>
                    <li>
                        <button type="submit" class="buttonActive"><@t.page 'button.search'/></button>
                    </li>
                <#if authorizedMap['cmsContent/export']>
                    <li>
                        <a class="button" href="cmsContent/export?_csrf=<@_csrfToken admin=true/>" target="dwzExport" targetType="navTab"><i class="icon-download-alt icon-large"></i> <@t.page 'button.export'/></a>
                    </li>
                </#if>
                </ul>
            </div>
        </div>
    </form>
</div>
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <#if parent?has_content>
                <li><a href="cmsContent/list.html?parentId=${(parent.parentId)!}&categoryId=${categoryId!}" target="navTab" rel="cmsContent/list"><i class="icon-circle-arrow-up icon-large"></i> <@t.page 'button.return'/></a></li>
                <li class="line">line</li>
            </#if>
<#if authorizedMap['cmsContent/add'] && categoryId?has_content>
        <@_modelList parentId=(parent.modelId)!''>
            <#list page.list as a>
                <@t.merge 'tempModelIds' a.id!/>
            </#list>
            <#assign size=0/>
            <li>
                <a href="cmsContent/addMore.html?categoryId=${(parent.categoryId)!categoryId!}&parentId=${parentId!}" target="dialog" mask="true" class="addMore"><i class="icon-double-angle-down icon-large"></i> <@t.page 'content.add'/></a>
                <ul>
            <@_category id=categoryId>
                <#if object.typeId?has_content && authorizedMap['cmsCategory/add']>
                    <li><a href="cmsCategory/add.html?id=${categoryId!}" target="navTab" rel="cmsCategory/edit"><i class="icon-edit icon-large"></i> <@t.page 'category.edit'/></a></li>
               </#if>
            </@_category>
            <@_categoryModel modelIds=t.tempModelIds categoryId=categoryId><#assign categoryModelMap=map/></@_categoryModel>
            <#list page.list as a>
                <#if categoryModelMap?has_content&&categoryModelMap[a.id]?has_content>
                    <#assign size++/>
                    <li><a href="cmsContent/add.html?categoryId=${(parent.categoryId)!categoryId!}&modelId=${a.id}&parentId=${parentId!}" target="navTab" rel="cmsContent/add"><i class="icon-plus icon-large"></i> <@t.page 'button.add_some_things' a.name/></a></li>
                </#if>
            </#list>
            <#if size=0 && authorizedMap['cmsCategory/add']>
                    <li><a href="cmsCategory/add.html?id=${categoryId!}&showAdvancedOptions=true" target="navTab" rel="cmsCategory/edit" title="<@t.page 'category.edit'/>"><i class="icon-edit icon-large"></i> <@t.page 'content.no_model'/></a></li>
            </#if>
                </ul>
            </li>
        </@_modelList>
            <li class="line">line</li>
</#if>
        <#if authorizedMap['cmsContent/check']>
            <li><a href="cmsContent/check?_csrf=<@_csrfToken admin=true/>" title="<@t.page 'confirm.batch_check'/>" target="selectedTodo" rel="ids"><i class="icon-check icon-large"></i> <@t.page 'button.batch_check'/></a></li>
        </#if>
        <#if authorizedMap['cmsContent/reject']>
            <li><a href="cmsContent/reject?_csrf=<@_csrfToken admin=true/>" title="<@t.page 'confirm.batch_reject'/>" target="selectedTodo" rel="ids"><i class="icon-exclamation icon-large"></i> <@t.page 'button.batch_reject'/></a></li>
        </#if>
        <#if authorizedMap['cmsContent/uncheck']>
            <li><a href="cmsContent/uncheck?_csrf=<@_csrfToken admin=true/>" title="<@t.page 'confirm.batch_uncheck'/>" target="selectedTodo" rel="ids"><i class="icon-check icon-large"></i> <@t.page 'button.batch_uncheck'/></a></li>
        </#if>
        <#if authorizedMap['cmsContent/refresh'] && !site.useStatic>
            <li><a href="cmsContent/refresh?_csrf=<@_csrfToken admin=true/>" title="<@t.page 'confirm.batch_refresh'/>" target="selectedTodo" rel="ids"><i class="icon-refresh icon-large"></i> <@t.page 'button.batch_refresh'/></a></li>
        </#if>
        <#if authorizedMap['cmsContent/publish']>
            <li><a href="cmsContent/publish?_csrf=<@_csrfToken admin=true/>" title="<@t.page 'confirm.batch_publish'/>" target="selectedTodo" rel="ids"><i class="icon-file-text-alt icon-large"></i> <@t.page 'button.batch_publish'/></a></li>
        </#if>
        <#if !parentId?has_content&&authorizedMap['cmsContent/moveParameters']>
            <li><a href="cmsContent/moveParameters.html" target="dialog" mask="true"><i class="icon-move icon-large"></i> <@t.page 'button.batch_move'/></a></li>
        </#if>
        <#if authorizedMap['cmsContent/delete']>
            <li class="line">line</li>
            <li><a href="cmsContent/delete?_csrf=<@_csrfToken admin=true/>" title="<@t.page 'confirm.batch_delete'/>" target="selectedTodo" rel="ids"><i class="icon-trash icon-large"></i> <@t.page 'button.batch_delete'/></a></li>
        </#if>
        </ul>
    </div>
    <table class="table" width="100%" layoutH targetType="ajax" rel="contentBox">
        <thead>
            <tr>
                <th width="20"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
                <th width="200"><@t.page 'content'/></th>
                <th width="30" orderField="comments" class="<#if orderField?has_content&&'comments'==orderField><#if 'asc'=orderType>asc<#else>desc</#if><#else>order</#if>"><@t.page 'content.comments'/></th>
                <th width="30" orderField="clicks" class="<#if orderField?has_content&&'clicks'==orderField><#if 'asc'=orderType>asc<#else>desc</#if><#else>order</#if>"><@t.page 'clicks'/></th>
                <th width="70" orderField="publishDate" class="<#if orderField?has_content&&'publishDate'==orderField><#if 'asc'=orderType>asc<#else>desc</#if><#else>order</#if>"><@t.page 'publish_date'/></th>
                <th width="40" orderField="default" class="<#if !orderField?has_content||'default'==orderField>desc<#else>order</#if>"><@t.page 'content.top_level'/></th>
                <th width="50"><@t.page 'status'/>/<@t.page 'inspector'/></th>
                <th width="100"><@t.page 'operate'/></th>
            </tr>
        </thead>
        <tbody>
            <#list page.list as a>
                <@t.merge 'userIds' a.userId!/>
                <@t.merge 'userIds' a.checkUserId!/>
                <@t.merge 'categoryIds' a.categoryId!/>
                <@t.merge 'modelIds' a.modelId!/>
                <@t.merge 'ids' a.id/>
            </#list>
            <@_sysLock userId=admin.id itemType='content' itemIds=t.ids><#assign lockMap=map!/></@_sysLock>
            <#if lockMap?has_content>
                <#list lockMap as k,lock>
                    <#if lock.userId?has_content><@t.merge 'userIds' lock.userId/></#if>
                </#list>
            </#if>
            <@_sysUser ids=t.userIds!><#assign userMap=map!/></@_sysUser>
            <@_category ids=t.categoryIds!><#assign categoryMap=map!/></@_category>
            <@_model ids=t.modelIds!><#assign modelMap=map!/></@_model>

            <#list page.list as a>
            <tr>
                <td class="center" title="${a.id}"><input name="ids" value="${a.id}" type="checkbox"></td>
                <td class="wrap">
                    <#if a.cover?has_content>
                        <div class="thumbnail">
                            <img src="${(a.cover)!}"/>
                        </div>
                    </#if>
                    <div class="box">
                        <h3 <#if lockMap[a.id?string]?has_content><#assign lockUser=(userMap[lockMap[a.id?string].userId?string].nickName)!''/>title="<@t.page 'lock.message' lockUser/> ${lockMap[a.id?string].createDate}"</#if>>
                            <#if lockMap[a.id?string]?has_content><i class="icon-lock icon-large"></i> </#if>[<span class="exclude-translate">${(categoryMap[a.categoryId?string].name)!}</span>] ${(a.copied?then('['+t.pageMessage('copied')+']',''))!}<a href="cmsContent/view.html?id=${a.id}" class="exclude-translate" target="dialog" rel="viewContent${a.id}">${(a.title)!}</a>
                        </h3>
                        <p>
                            <#if modelMap[a.modelId]?has_content&&modelMap[a.modelId].hasChild>
                                <label><a href="cmsContent/list.html?parentId=${a.id}&categoryId=${a.categoryId!}" class="btnText" target="navTab" rel="cmsContent/list"><@t.page 'content.child_management'/></a></label>
                            </#if>
                            <label><@t.page 'content.promulgator'/>:</label><span class="exclude-translate">${(userMap[a.userId?string].nickName)!}</span>
                            <label><@t.page 'model'/>:</label><span class="exclude-translate">${(modelMap[a.modelId].name)!}</span>
                        </p>
                        <#if a.expiryDate?has_content><p><label><@t.page 'expiry_date'/>:</label><span class="exclude-translate">${a.expiryDate!}</span></p></#if>
                    </div>
                </td>
                <td class="center">
                    <#if authorizedMap['cmsComment/list']>
                        <a href="cmsComment/list.html?contentId=${a.id}" target="navTab" rel="cmsComment/list" icon="<i class='icon-comment icon-large'></i>" title="<@t.page 'comment.management'/>">${a.comments!}</a>
                    <#else>
                        ${a.comments!}
                    </#if>
                </td>
                <td class="center">${a.clicks!}</td>
                <td class="center" title="<@t.page 'create_date'/>:${a.createDate!}">${a.publishDate!}</td>
                <td class="center">${a.sort!}</td>
                <td>
                    <@t.page 'status.content.'+a.status/>
                    <#if 1=a.status || 3=a.status>/ <span class="exclude-translate">${(userMap[a.checkUserId?string].nickName)!}</span></#if>
                </td>
                <td class="wrap">
                    <a href="cmsContent/add.html?id=${a.id}" class="edit btnText blue" target="navTab" rel="cmsContent/edit"><i class="icon-edit"></i> <@t.page 'content.edit'/></a>
                    <#if 1=a.status>
                        <#if authorizedMap['cmsContent/sortParameters']>
                            <#if dept?has_content>
                                <a href="cmsContent/sortParameters.html?id=${a.id}&sort=${a.sort}" class="btnText blue" target="dialog" width="450" height="180" mask="true"><@t.page 'top'/></a>
                            </#if>
                        </#if>
                        <#if authorizedMap['cmsContent/add']>
                            <a href="cmsContent/add.html?copyId=${a.id}" class="btnText blue" target="navTab" rel="cmsContent/add" icon="<i class='icon-plus'></i>" title="<@t.page 'content.add'/>"><i class="icon-copy"></i> <@t.page 'button.copy'/></a>
                        </#if>
                        <#if authorizedMap['cmsCategory/lookupBySiteId']>
                            <a href="cmsCategory/lookupBySiteId.html?id=${a.id}&modelId=${a.modelId!}&currentCategoryId=${a.categoryId!}" class="btnText blue" target="dialog" mask="true"><i class="icon-asterisk"></i> <@t.page 'button.distribute'/></a>
                        </#if>
                        <#if authorizedMap['cmsContent/push']>
                            <a href="cmsContent/push.html?contentId=${a.id}" class="btnText blue" target="dialog" mask="true"><@t.page 'button.push'/></a>
                        </#if>
                    <#elseif 2=a.status>
                        <#if authorizedMap['cmsContent/check']>
                            <a href="cmsContent/check?ids=${a.id}&_csrf=<@_csrfToken admin=true/>" class="btnText green" title="<@t.page 'confirm.check'/>" target="ajaxTodo"><i class="icon-check"></i> <@t.page 'button.check'/></a>
                        </#if>
                        <#if authorizedMap['cmsContent/reject']>
                            <a href="cmsContent/reject?ids=${a.id}&_csrf=<@_csrfToken admin=true/>" class="btnText red" title="<@t.page 'confirm.reject'/>" target="ajaxTodo"><i class="icon-exclamation"></i> <@t.page 'button.reject'/></a>
                        </#if>
                    </#if>
                    <#if authorizedMap['cmsContent/changeModelParameters']>
                        <a href="cmsContent/changeModelParameters.html?id=${a.id}&parentId=${(modelMap[a.modelId].parentId?url)!}" class="btnText red" target="dialog" mask="true"><i class="icon-list-alt"></i> <@t.page 'content.change_model'/></a>
                    </#if>
                </td>
            </tr>
            </#list>
        </tbody>
    </table>
    <#assign rel='contentBox'/>
    <#include "../include_page/page.html"/>
</div>
</@_contentList>
<#else>
    <div class="pageContent"><#if categoryId?has_content><@t.message 'verify.notEquals.siteId'/></#if></div>
</#if>